﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace QianJin.Views.Shared
{
    public class Product : BaseMaster
    {
        public Product()
        {
            ShowShoppingCartInfo = true;
            //TitleText = this.GetString("pm_productlist");
        }

        public bool IsCurrentCategory(string id)
        {
            if (this.Model.CurrentCategory == null)
            {
                return false;
            }

            return string.Equals(id, this.Model.CurrentCategory.id, StringComparison.OrdinalIgnoreCase);
        }

        public bool ShowShoppingCartInfo
        {
            get;
            set;
        }
        private string titleText;
        public string TitleText
        {
            get
            {
                return string.IsNullOrEmpty(titleText) ? this.Model.CurrentCategory.Name : titleText;
            }
            set
            {
                titleText = value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            var m = (Site)this.Master;
            if (string.IsNullOrEmpty(this.BannerImgName))
            {
                m.BannerImgName = "index_img.jpg";//"banenr_02.jpg";
            }
            else
            {
                m.BannerImgName = this.BannerImgName;
            }

            if (this.NavPos == NavigationPosition.None)
            {
                m.NavPos = NavigationPosition.Product;
            }
            else
            {
                m.NavPos = this.NavPos;
            }
        }
    }
}
